﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain.BLL;
using Domain.Entity;

namespace MySQLTest
{
    public class Operation
    {
        public static void Test()
        {
            var list = new AdminsBLL().GetList_ByOtherConnection();
            foreach (var item in list)
            {
                Console.WriteLine("用户名：{0}  权限：{1}  性别：{2}", item.User, item.Power, item.Sex);
            }
            //Database db = DatabaseFactory.CreateDatabase();
            //string sql = "Update Admins SET Power = @Power, Sex = @Sex WHERE User = 'test01'";
            //using (DbCommand cmd = db.GetSqlStringCommand(sql))
            //{
            //    db.AddInParameter(cmd, "@Power", DbType.Int16, 1|2);
            //    db.AddInParameter(cmd, "@Sex", DbType.String, 2);
            //    db.ExecuteNonQuery(cmd);
            //}

            //sql = "SELECT * FROM Admins";
            //using (DbCommand cmd = db.GetSqlStringCommand(sql))
            //{
            //    using (IDataReader idr = db.ExecuteReader(cmd))
            //    {
            //        while (idr.Read())
            //        {
            //            Console.WriteLine("用户名：{0}  权限：{1}  性别：{2}", idr["User"], idr["Power"], idr["Sex"]);
            //        }
            //    }
            //}
        }
    }
}
